<template>
  <div>
    <el-container>
      <el-header height="70px">
        <p class="header_title">运营设置</p>
        <!--  -->
        <el-breadcrumb separator="/">
          <el-breadcrumb-item>运营维护</el-breadcrumb-item>
          <el-breadcrumb-item>运营设置</el-breadcrumb-item>
          <el-breadcrumb-item></el-breadcrumb-item>
        </el-breadcrumb>
      </el-header>

      <el-main>
        <el-card class="box-card">
          <div slot="header">
            <span>运营设置</span>
          </div>

          <el-row>
            <el-col> 
              <el-button type="success" class="add" @click="onSubmit" >保存</el-button>
            </el-col>
            <el-col>
                <p>联系电话</p>
                <el-input type="phone" clearable v-model="phonelist.phone" placeholder="联系电话" @onblur="vaildPhone" @oninput="value=value.replace(/[^0-9.]/g,'')"></el-input>
            </el-col>
          </el-row>
        </el-card>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  data(){
    return{
      phonelist:{
        phone:""
      }
    }
  },
  methods:{
    async onSubmit(){
        const res = this.http.post('/operate/add',this.phonelist)
       
        console.log(res);
    },
    testPhone(str) {
      const reg = /^1[3|4|5|7|8|6|9][0-9]\d{8}$/;
      return reg.test(str);
    },
    vaildPhone() {
      if (!this.testPhone(this.a)) {
        alert("手机号错误");
      }
    },
  },
  created(){

  }
};
</script>

<style scoped>
.box-card{
    height: 400px;
}
</style>
